<template>
  <div class="detail" v-if="dataContent">
    <!-- detail{{dataContent}} -->
    <h1>{{dataContent.title}}</h1>
    <span>{{dataContent.time}}</span>
    <p>{{dataContent.content}}</p>
  </div>
</template>

<script>
import baseUrl from '@/baseUrl'
import axios from 'axios'
export default {
  data () {
    return {
      dataContent: null
    }
  },
  created () {
    // console.log('detail', this.$route.params.routerDetail)
    // 请求详情
    axios.get(`${baseUrl}${this.$route.params.routerDetail}`)
      .then((res) => {
        this.dataContent = res.data.list.filter(item => item.id === this.$route.params.id)[0]
        // console.log(dataContent)
      })
  }
}
</script>
